<?php

class PrimaryKey {

	var $sName;
	var $oTable;
	var $aColumns;
	
	function PrimaryKey ( $sName, &$oTable ) {

		$this->sName    = $sName;
		$this->oTable   =& $oTable;
		$this->aColumns = array();
	}
	
	function GetName() {
		return $this->sName;	
	}

	function GetTableName() {
		return $this->oTable->GetName();	
	}

	function GetColumnNames() {
		return array_keys( $this->aColumns );	
	}
	
	function AddColumn( &$oColumn ) {
		if ( is_object( $oColumn ) ) {
			$this->aColumns[ $oColumn->GetName() ] =& $oColumn;
			$oColumn->SetIsPartOfPrimaryKey();
		} else {
			echo( 'Invalid column for primary key' . $this->sName . "\n");	
		}
	}
	
}

?>
